package javabase.util;

import java.util.Arrays;
import java.util.List;

public class ArraysDemo {

	public static void main(String[] args) {
		
		// java提供数组复制
		int [] srcArr = new int[] {1, 2, 3};
		int [] desArr = new int[] {5, 6};
		System.arraycopy(srcArr, 1, desArr, 0, 2);
		for (int i : desArr) {
			System.out.print(i);
		}
		System.out.println("\n");
		
		// asList
		List<int[]> list = Arrays.asList(desArr);
		for (Object obj : list) {
			if (obj instanceof int[]) {
				int[] arr0 = (int[])(obj);
				System.out.println("arr0:" + arr0[0] + "-----" + arr0[1]);
			}
		}
		
		// Arrays copyOf
		System.out.print(Arrays.copyOf(desArr, 6).length);
	}

}
